/**
 * Title:        代理数据同步
 * Company:      泛微软件
 */


package checkDetail;

import general.BaseBean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONObject;

import weaver.general.Util;



public class WorkflowBrowdefCheck extends BaseBean implements CheckBase  {

    @Override
    public JSONObject checkData(HashMap dataMap) {
        setRecordSet();
        (new BaseBean()).writeLog("WorkflowBrowdefCheck  start");

        List resultList = new ArrayList();
        String result = resultOk;
        String sqlStr = "";
        sqlStr +=" select wfdef.title,wfb.workflowname,htmllabelindex.indexdesc as fielname,wfdef.workflowid from workflow_browdef wfdef ";
        sqlStr +=" inner join workflow_base wfb on wfb.id = wfdef.workflowid ";
        sqlStr +=" inner join workflow_billfield wfbf on wfbf.id = wfdef.fieldid ";
        sqlStr +=" inner join htmllabelindex on wfbf.fieldlabel = htmllabelindex.id ";
        recordSet.executeSql(sqlStr);
        
        int cnt = 0;
        while(recordSet.next()){
            String title = recordSet.getString("title");
            String workflowname = recordSet.getString("workflowname");
            String fielname = recordSet.getString("fielname");
            String workflowid = recordSet.getString("workflowid");
            result = resultNeedFix;
            Map resultMap = new HashMap<String,String>();
            resultMap.put("showMessage", "流程[" + workflowname + "]中字段[" + fielname + "]存在浏览数据定义[" + title + "]。");
            resultMap.put("linkurl","/workflow/workflow/Browsedatadefinition.jsp?ajax=1&wfid=" + workflowid);
            resultList.add(resultMap);
            cnt++;
        }
        (new BaseBean()).writeLog("WorkflowBrowdefCheck  end");
        return formatReturnJsonCheck(result, resultList,this);
    }

    @Override
    public JSONObject fixData(HashMap dataMap) {
        return checkData(dataMap);
    }

    @Override
    public String getClassName() {
        return "监测浏览数据定义";
    }

    @Override
    public String getClassDesc() {
        return "显示所有的浏览数据定义";
    }

}



